package com.fks.fks_service.mapper;

import com.fks.fks_service.pojo.MorningAndNightTime;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface SeeMapper {

    @Insert("insert into fks_see (shopId,uid,seeTime,seeType)values" +
            "(#{shopId},#{userId},#{nowTime},'0')")
    int addSee(int userId, int shopId,String nowTime);

    @Select("select count(*) from fks_see where seeTime>#{time.morning} and seeTime<#{time.night}  and seeType=0")
    int getShopSeeByMerchantUserId(MorningAndNightTime time);

    @Select("select count(*) from fks_see where seeTime>#{time.lastMorning} and seeTime<#{time.lastNight} and seeType=0")
    int getShopSeeByMerchantUserId2(MorningAndNightTime time);

    @Insert("insert into fks_see (uid,seeTime,activityId,seeType)values(#{userId},#{nowTime},#{activityId},'1')")
    int addActivitySee(int activityId, int userId, String nowTime);

    @Select("select count(*) from fks_see where seeTime>#{time.morning} and seeTime<=#{time.night}  and seeType=1")
    int getActivitySeeByMerchantUserId(MorningAndNightTime time);

    @Select("select count(*) from fks_see where seeTime>#{time.lastMorning} and seeTime<=#{time.lastNight} and  seeType=1")
    int getActivitySeeByMerchantUserId2(MorningAndNightTime time);

    @Select("select seeTime from fks_see where seeTime>#{time.morning} and seeTime<=#{time.night}  and seeType=0")
    List<String> getShopSeeList(MorningAndNightTime time);

    @Select("select seeTime from fks_see where seeTime>#{time.morning} and seeTime<=#{time.night}  and seeType=1")
    List<String> getActivitySeeList(MorningAndNightTime time);

}
